import { Button } from 'antd';
import React from 'react';
import styles from './MyBtn.less';

interface BtnPros {
  BtnName?: string;
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
  children?: any;
}
export default ({ onClick, children }: BtnPros) => {
  let BtnName = '';
  React.Children.map(children, (child: any) => {
    if (typeof child === 'string') BtnName = child;
  });

  return (
    <>
      <Button className={styles.btn} onClick={onClick}>
        {BtnName}
      </Button>
    </>
  );
};
